package com.situ.mall.admin.service.impl;

import com.situ.mall.admin.entity.Attachment;
import com.situ.mall.admin.mapper.AttachmentMapper;
import com.situ.mall.admin.service.IAttachmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.situ.mall.admin.vo.UploadAttachmentVO;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author membergpf
 * @since 2023-03-21
 */
@Service
public class AttachmentServiceImpl extends ServiceImpl<AttachmentMapper, Attachment> implements IAttachmentService {

    @Override
    public Integer insert(Attachment attachment) {
        baseMapper.add(attachment);
        return baseMapper.maxId().intValue();
    }

    @Override
    public void update1(int parseInt, int intValue, String name, int sequence) {
        baseMapper.update1(parseInt, intValue, name,sequence);
    }

    @Override
    public UploadAttachmentVO selectById(Integer proid) {
        UploadAttachmentVO vo=new UploadAttachmentVO();

        vo.setData(baseMapper.selectAttach(proid));
        return vo;
    }

    @Override
    public int selectProId(Integer id) {
        return baseMapper.selectProIdMax(id).intValue();
    }

    @Override
    public void add(String firstimg, Integer id) {
        baseMapper.insert1(firstimg,id);
    }
}
